/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.deliccio.entitys;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.deliccio.connect.Entidad;


@Entity
@Table(name = "foto")
public class Foto implements Entidad, Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idfoto", nullable = false)
    private Integer id;
    @Column(name = "nombre", length = 20)
    private String nombre;
    @Column(name = "ruta", length = 200)
    private String ruta;
    @Column(name = "carpeta", length = 20)
    private String carpeta;
    @Column(name = "codigo", length = 20)
    private String codigo;
   /* @OneToMany(cascade = CascadeType.ALL, mappedBy = "foto", fetch = FetchType.LAZY)
    private List<Sucursales> sucursalesList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "foto", fetch = FetchType.LAZY)
    private List<Mesa> mesaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "foto", fetch = FetchType.LAZY)
    private List<Producto> productoList;
    @OneToMany(mappedBy="foto")
	private List<FotoPorSucursal> fotoPorSucursales;
*/
    

    private transient int intWith;
    private transient int intHeight;
    private transient String strformato;
    

    public Foto() {
    }

    public Foto(String nombre,String ruta,String carpeta,String codigo){
		this.nombre=nombre;
		this.ruta=ruta;
		this.carpeta=carpeta;
		this.codigo=codigo;
	}

	public int getIntWith(){
		return intWith;
	}

	public void setIntWith(int intWith){
		this.intWith=intWith;
	}

	public int getIntHeight(){
		return intHeight;
	}

	public void setIntHeight(int intHeight){
		this.intHeight=intHeight;
	}

	public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getRuta() {
        return ruta;
    }

    public void setRuta(String ruta) {
        this.ruta = ruta;
    }

    public String getCarpeta() {
        return carpeta;
    }

    public void setCarpeta(String carpeta) {
        this.carpeta = carpeta;
    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }
/*
    public List<Sucursales> getSucursalesList() {
        return sucursalesList;
    }

    public void setSucursalesList(List<Sucursales> sucursalesList) {
        this.sucursalesList = sucursalesList;
    }

    public List<Mesa> getMesaList() {
        return mesaList;
    }

    public void setMesaList(List<Mesa> mesaList) {
        this.mesaList = mesaList;
    }

    public List<Producto> getProductoList() {
        return productoList;
    }

    public void setProductoList(List<Producto> productoList) {
        this.productoList = productoList;
    }

*/
	public Integer getId(){
		return id;
	}


	public void setId(Integer id){
		this.id=id;
	}



	public String getStrformato(){
		return strformato;
	}

	public void setStrformato(String strformato){
		this.strformato=strformato;
	}

	@SuppressWarnings("rawtypes")
		@Override
		public String toString() {
			String toString = "[";
			@SuppressWarnings("unused")
			String campo,iscampo = "";
			try {
				Class clase = this.getClass();
				Method[] metodos = clase.getDeclaredMethods();
				for (Method met:metodos) {					
					if (met.getName().indexOf("get") >= 0) {
						toString += met.getName()+"="+met.invoke(this, null)+" - ";
					}
				}								
				toString+="]";
			} catch (Exception e) {			
				System.out.println(e);
			}
			return toString;
		}
    
}
